package com.xinfu.newproject.adapter.notice_adapter;

import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.xinfu.newproject.R;
import com.xinfu.newproject.bean.matter_repair.MatterListDataBean;
import com.xinfu.newproject.interface_.SwichFragmentInterface;

import static com.xinfu.newproject.activity.NoticeActivity.FRAGMENT_ONE;

/**
 *
 */
public class NoticeListAdapter extends BaseQuickAdapter<MatterListDataBean, BaseViewHolder> {

    TextView newMsgTv, timeTv, priceTv, carId;

    public NoticeListAdapter() {
        super(R.layout.item_notice_list, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, MatterListDataBean item) {
        newMsgTv = helper.getView(R.id.item_notice_list_new_msg_tv);
        helper.setText(R.id.item_notice_list_time_tv, item.getTime());
        helper.setText(R.id.item_notice_list_type_name_tv, item.getTypeName());
        if (item.getStatus().equals("1")) {
            newMsgTv.setVisibility(View.VISIBLE);
        } else {
            newMsgTv.setVisibility(View.INVISIBLE);
        }
        helper.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SwichFragmentInterface swichFragmentInterface = (SwichFragmentInterface) mContext;
                swichFragmentInterface.setSelectedFragment(FRAGMENT_ONE, 0);
            }
        });
    }

    ClickableSpan clickableSpan = new ClickableSpan() {
        @Override
        public void onClick(View widget) {
//            ToastUtils.showShortToast("事件触发了 landscapes and nedes");
        }

        @Override
        public void updateDrawState(TextPaint ds) {
//            ds.setColor(Utils.getContext().getResources().getColor(R.color.clickspan_color));
//            ds.setUnderlineText(true);
        }
    };


}
